package com.lwc.cfdns.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lwc.cfdns.pojo.BaseEntity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.lwc.cfdns.pojo.dto.ValidGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 系统配置表
 *
 * @TableName cfdns_system_config
 */
@TableName(value = "cfdns_system_config")
@Data
public class SystemConfig extends BaseEntity implements Serializable {
    /**
     * 参数主键
     */
    @TableId(type = IdType.AUTO)
    @NotNull(message = "ID不能为空", groups = {ValidGroup.Update.class})
    private Long id;

    /**
     * 系统配置分类id
     */
    @NotNull(message = "分类ID不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private Long cateId;

    /**
     * 配置名称
     */
    @NotBlank(message = "配置项名称不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String name;

    /**
     * 配置键名(标识)
     */
    @NotBlank(message = "配置键名不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String enName;

    /**
     * 配置项类型，具体参见字典key：system_config_type
     */
    @NotBlank(message = "配置项类型不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String keyType;

    /**
     * 配置项内容，select,radio,checkbox等类型使用，key:value;格式；或者输入框型的placeholder
     */
    private String rule;

    /**
     * 描述
     */
    private String remark;

    /**
     * 排序值
     */
    private Integer sort;

    /**
     * 参数键值
     */
    private String value;

    /**
     * 是否必填，1必填，0非必填
     */
    @Length(min = 1, max = 1, message = "是否必填参数长度只能为一个字符", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String required;

    /**
     * 系统内置（Y是 N否）
     */
    @Length(min = 1, max = 1, message = "系统内置参数长度只能为一个字符", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String type = "N";

    /**
     * 状态 0正常 1禁用
     */
    @Length(min = 1, max = 1, message = "状态参数长度只能为一个字符", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String status;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}